1. Field of the Invention
The invention relates to a method of transferring data from a sender process to a plurality of receiver processes, at least some of which are described in a hardware description language, and to hardware produced in accordance with such a method.
2. Description of the Related Art
Occam is a computer language in which some parts of a program may be made to run concurrently (see Inmos Ltd., The Occam2 Reference Manual, Prentice-Hall International, 1988). The parts are called processes. The programmer may declare synchronous channels. Each channel connects exactly two processes in such a way that data can be sent from one (the sender process) to the other (the receiver process) synchronously. That is, if the sender starts to send first it must wait until the receiver is ready to receive, likewise if the receiver tries to receive first it must wait until the sender is ready to send.
Therefore data is never lost by (say) the sender overwriting a previous message before the receiver receives it; and never received twice by (say) the receiver performing a receive twice without the sender updating the context of the channel in between.
For example, in Occam:
CHAN OF INT ch: - - declare ch as an integer channelPARSEQ - - first process. . .- - do some thingsch | x- - send the value x down channel ch. . .- - do some more thingsSEQ - - second procees (in parallel with first). . .- - do some thingsch ? y- - receive a value from channel ch,- - and store in y. . .- - do some more things
The concrete syntax for send and receive may vary in other languages, for example send (ch, x) instead of ch 1 x or y=received (ch) instead of ch ? y. However the communication is always between precisely two processes.
VHDL is a hardware description language, which is also used extensively for hardware synthesis (see Steve Carlson, Introduction to HDL-based Design Using VHDL, Synopsys Inc., Calif., 1991 and IEEE Standard VHDL Language Reference Manual, IEEE Std 1076-1993, IEEE, New York, 1993). Concurrent VHDL processes communicate by unsynchronised shared signals. One writer process (analogous to a sender) may write a value to a signal, and one or several readers (analogous to receivers) may read that value. However, it is entirely up to the designer to ensure that written data is read when it is valid by the readers. This can be done by building an handshake protocol, so that readers write to another signal (dedicated to this purpose) to indicate their status with regard to the data transfer.
For example, in VHDL you assign the value of an expression E to a signal S with the construct S (=E, and read from a signal S just by using its name in an expression. There is no limit to how many processes may read from S (although only one may write to S unless the signal is declared with a resolution function). However there is no automatic synchronisation. Values may be read more often than written (and so data repeated) or written more often than read (and so data lost).
Bach (see British Patent Publication No. 2317245) is a language similar to the software language of C, but which supports parallelism and communication like Occam, and which may be used to synthesis hardware. (Because of this feature, the Bach compiler which complies the Bach language into hardware is called a hardware compiler). That is, the syntax is like C (with extensions), but the semantics are more akin to Occam, with its parallelism and synchronised communication. In Bach data may be sent along synchronous channels as in Occam.
Note particularly that communication is always one to one. One process sends, and another process receives. To send data to more processes requires more channels.
In addition there are global variables, which may be written and read by several processes, but without automatic synchronisation. It is possible to use shared variables to distribute information to several processes, but then there is no guaranteed synchronisation, and the user must invent an ad-hoo signalling system to ensure data is correctly transferred. In Bach such shared variables are called achans for asynchronous channels.
For example, in Bach,
Void main (void){chan int ch:// declare ch as a synchronised// channel carrying integer datapar {{// first process. . .// do some thingssend (ch, x);// send the value x down// channel ch. . .// do some more things}{// second process (in parallel with first). . .// do some thingsy = receive (ch):// receive a value from channel// ch, and store in y. . .// so some more things}}}
The Bach compilers convert these constructs either into software for execution on a microprocessor or into a hardware description for the design of a special purpose integrated circuit.